<?php
$ae_order_detail = array(
    array(
        "sku" => "Test_0123_8",
        "ae_sku" => "210076681691516",
        "orderItemId"=>"ccdd",
        "ae_sm_code"=>""
    ),
    array(
        "sku" => "TEst_0123",
        "ae_sku" => "210076681691516",
        "orderItemId"=>"400110007426438284_99",
        "ae_sm_code"=>""
    ),
);

$ae_order_detail_relation = array_column($ae_order_detail,'orderItemId','sku');

function getAeOrderDetailRelation(&$ae_order_detail_relation, $productSku) : string{
    $found = current(array_filter($ae_order_detail_relation, function ($key) use ($productSku){
        return strcasecmp($key, $productSku) === 0;
    },ARRAY_FILTER_USE_KEY));

    if(empty( $found)){
        return "";
    }
    return $found;
}

$ret = getAeOrderDetailRelation($ae_order_detail_relation,"TEST_0123");
print_r($ret);
die();
